<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="../../v2/common/jspcommon.jsp"%>
<title>订单查看、修改</title>
<script type="text/javascript">
$(function(){
	$("#pager").pager({ pagenumber: ${orderListPageModel.currentPage}, 
		pagecount: ${orderListPageModel.totalPage},
		buttonClickCallback: function(page){
			$("#product_content").load("/misc/product/readOrder.htm?page="+page);
		}
	});
});




	function updateOrderStatus(key,orderId){
		$.post("/misc/product/updateOrderStatus.htm",{
			identifier:orderId, 
			status : key
		},function(data){
			if(data=='success'){
				clearRushStyle();
				$('#product_content').load("/misc/product/readOrder.htm");
			}
		});	
	}

	function viewOrder(orderId){
		var load = $("#viewOrder");
		var width = load.width();
		var height = load.height();
		var left = (screen.width - width) / 2 -300
				+ document.documentElement.scrollLeft;
		var top = (screen.height - height) / 2
				+ getScrollTop()-500;
		$("#viewOrder").css({
			"left" : left,
			"top" : top
		});
		$('#viewOrder').load("/misc/product/viewOrder.htm?orderId="+orderId).show();
		
	}
	
	function closed(){
		$('#viewOrder').hide();
	}
</script>


</head>
<body>
	
	<table border="1" width="80%">
		<tr>
		    <td>订单名称</td>
			<td>订单操作日期</td>
			<td>商品名称</td>
			<td>数量</td>
			<td>订单的产品分类</td>
			<td>订单状态</td>
			<td>状态操作</td>
			<td>备注</td>
		</tr>
		
		<c:forEach items="${orderListPageModel.list}" var="order">
		<tr>
		    <td><a	href="javascript:void(0);" onclick="viewOrder('${order.identifier}');" style="font-size: 15px">${order.title}</a></td>
			<td><fmt:formatDate value="${order.gmtModified}" pattern="MM-dd HH:mm" /></td>
			<td>${order.productName}</td>
			<td>${order.productQuantity}</td>
			<td>${order.categoryName}</td>
			<td>
				<c:if test="${empty order.status}">系统出单中....</c:if>
				<c:if test="${order.status =='01'}">填写地址</c:if>
				<c:if test="${order.status =='02'}">等待发货</c:if>
				<c:if test="${order.status =='03'}">已发货</c:if>
				<c:if test="${order.status =='04'}">已完成</c:if>
				<c:if test="${order.status =='05'}">已取消</c:if>
				<c:if test="${order.status =='06'}">等待点评</c:if>
				<c:if test="${order.status =='07'}">填写电话</c:if>
				<c:if test="${order.status =='08'}">已预定</c:if>
				<c:if test="${order.status =='09'}">已参与</c:if>
				<c:if test="${order.status =='10'}">没参与</c:if>
			</td>
			<td>
				<c:forEach items="${order.mapStatus}" var="map">
					<input  type="button" value="${map.value}"  onclick="updateOrderStatus('${map.key}','${order.identifier}')" style="width: 100px"/><br/>
				</c:forEach>
				<br/>
				<br/>
			</td>
			<td>${order.remark}</td>
		</tr>
		</c:forEach>
		
	</table>
	<div id="viewOrder" style="background-color:#D1EEEE; z-index: 9999;width:900px;height:400px;border:1px solid #DDD;padding:15px; position:relative; display: none;" ></div>
	<c:if test="${orderListPageModel.totalRecord > 0}">
				<div id="pager" class="h_page"></div>
	</c:if>
	
</body>
</html>